import { defineStore } from "pinia";
import { Names } from "../../store-namespace";
import { _get, _post, _put, _delete, http } from "@/utils/axios";
import { WarningRule } from "@/api/backend/index";

export const useWarningRule = defineStore(Names.WarningRule, {
  state: () => {
    return {
      single: <any>{},
      tags: <any>{},
      type: <any>[],
      typeFlag: <any>[], //策略启用
      typeType: <any>[], //策略类型
      typeControl: <any>[], //是否开启远程控制
    };
  },
  getters: {},
  actions: {
    //获取告警策略列表数据
    getWarningRuleList(filter: any) {
      return new Promise((resolve, reject) => {
        _get(WarningRule + "/list", filter, "json", "").then((res: any) => {
          console.log("获取告警策略列表数据", res);
          resolve(res);
        });
      });
    },
  },
});
